package whu.edu.assingment6.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;
import whu.edu.assingment6.Aspect.AopAspect;
import whu.edu.assingment6.Aspect.count;

import javax.annotation.Resource;

/**
*
 * @author  guanruwang
 * @date 2023/10/25$
 */
@RestController
public class TestController {

    @Resource
    private AopAspect aopAspect;
    @GetMapping("/test")
    @count
    public ResponseEntity<String> testGet(){
        System.out.println("testGet");
        return ResponseEntity.ok("testPut");
    }

    @PostMapping("/test")
    @count
    public ResponseEntity<String> testPost(){
        return ResponseEntity.ok("testPost");
    }

    @PutMapping("/test")
    @count
    public ResponseEntity<String> testPut(){
        return ResponseEntity.ok("testPut");
    }

    @GetMapping("/print")
    public void print(){
        aopAspect.print();
    }
}
